/**
	practical informatics exercise 1.3

	author: Sebastian Geschke
*/

#ifndef _AVL_TREE_H
#define _AVL_TREE_H

#include "Tree.h"

class AvlTree : public Tree {
public:
	AvlTree() : Tree() { }

	~AvlTree() {  }

	void insert(double d) {
		if (!root) root = new Node(d);
		else insert(root, d);
	}

private:
	virtual void insert(Node* &node, double d);

	void rotate_right(Node* &node);
	
	void rotate_right_left(Node* &node);
	
	void rotate_left(Node* &node);
	
	void rotate_left_right(Node* &node);
};

#endif /* _AVL_TREE_H */